import physgin.*;
import java.applet.Applet;
import javax.swing.*;
import java.awt.*;
import com.sun.j3d.utils.applet.JMainFrame;

public class Level extends Applet
{
  J3dWorld w;
  BodyController b;
  
  public static void main(String[] args)
  {
    Level program = new Level();
    JMainFrame mf = new JMainFrame(program, 500, 500);
  }
  
  Level()
  {
    setLayout(new BorderLayout());
    w = new J3dWorld();
      w.setBackground("background1.jpg");
    b = new BodyController(w);
    Component c = (Component) w.getCanvas();
    add(c);
    
    J3dBody x;
    //floor 1
    for (int i = 1; i < 8; i++)
    {
      x = new J3dBody("floor.jpg",Shapes.SQUARE, ((i*0.8f)-3.2f),-0.4f, 101f, 0.4f, 0f,0f, 0.0f, 0.0f);
      b.addBody(x);
    }
    
    //floor 2
    for (int i = 1; i < 8; i++)
    {
      x = new J3dBody("floor.jpg",Shapes.SQUARE, ((i*0.6f)-2.8f),1.4f, 101f, 0.3f, 0f,0f, 0.0f, 0.0f);
      b.addBody(x);
    }
    
    //floor 3
    for (int i = 1; i < 8; i++)
    {
      x = new J3dBody("floor.jpg",Shapes.SQUARE, ((i*0.6f)-1.4f),3.f, 101f, 0.3f, 0f,0f, 0.0f, 0.0f);
      b.addBody(x);
    }
    
    //leftwall
    for (int i = 1; i < 8; i++)
    {
      x = new J3dBody("wall.jpg",Shapes.SQUARE, -2.8f,((i*0.6f) - 0.3f), 101f,0.3f, 0f,0f, 0.0f, 0.0f);
      b.addBody(x);
    }

    //rightwall
    for (int i = 1; i < 8; i++)
    {
      x = new J3dBody("wall.jpg",Shapes.SQUARE, 2.8f,((i*0.6f) - 0.3f), 101f,0.3f, 0f,0f, 0.0f, 0.0f);
      b.addBody(x);
    }
      
                                        //position(x&y), mass, size, velocity(x&y), orientation, elasticity
    J3dBody player = new J3dBody("circle.jpg",Shapes.CIRCLE, 1.8f,4.5f, 3f,0.3f, -5.0f,0.0f, 0f,.8f);
    b.addBody(player);
    J3dBody enemy = new J3dBody("monster.jpg",Shapes.SQUARE, 1.3f,0.4f, 3f,0.3f,-1.0f,0.0f, 0f,.8f);
    b.addBody(enemy);
      b.start(); 
  }
}
